package com.lz.yz.member.service.impl;

import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.UUID;

@Component
public class TokenGenerator {
    private static final long DEFAULT_EXPIRE_MS = 30 * 24 * 60 * 60 * 1000L;

    public String genToken() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }

    public Date genExpireDate(Date begin) {
        long beginTs = begin.getTime();
        Date expire = new Date(beginTs + DEFAULT_EXPIRE_MS);
        return expire;
    }
}
